package com.base.service.system.entity;
import java.util.List;

import com.base.core.framework.sql.entity.BaseV2Ext;
import com.base.core.head.converter.ListLongConverterEditor;
import com.gitee.magic.core.converter.PropertyConverter;
import com.gitee.magic.jdbc.persistence.annotation.Entity;
import com.gitee.magic.jdbc.persistence.annotation.Table;
import com.gitee.magic.jdbc.persistence.source.jdbc.script.annotations.ColumnDef;
import com.gitee.magic.jdbc.persistence.source.jdbc.script.annotations.Indexes;
import com.gitee.magic.jdbc.persistence.source.jdbc.script.annotations.IndexesUnion;
import com.gitee.magic.jdbc.persistence.source.jdbc.script.annotations.ScriptConverter;
import com.gitee.magic.jdbc.persistence.source.jdbc.script.annotations.TableDef;
import com.gitee.magic.jdbc.persistence.source.jdbc.script.annotations.indexes.Normal;
import com.gitee.magic.jdbc.persistence.source.jdbc.script.annotations.indexes.UniqueUnion;
import com.gitee.magic.jdbc.persistence.source.jdbc.script.converter.FieldText;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * @author start
 */
@Getter@Setter@ToString
@Entity("user")
@Table("sys_user")
@TableDef(comment = "用户", 
indexes = @IndexesUnion(unique = @UniqueUnion(fields = {"userName","deleted"})))
public class UserDO extends BaseV2Ext {

    private static final long serialVersionUID = 1L;

    public UserDO() {
    }

    @ColumnDef(indexes = @Indexes(normal = @Normal), length = 32, comment = "用户名")
    private String userName;

    @ColumnDef(length = 32, comment = "密码MD5")
    private String password;

    @ColumnDef(length = 32, comment = "姓名")
    private String name;
    
    @ColumnDef(comment = "是否禁用")
    private Boolean disable;

    @ColumnDef(comment = "验证器Key")
    private String secretKey;

    @ColumnDef(comment = "角色Ids")
    @ScriptConverter(FieldText.class)
    @PropertyConverter(ListLongConverterEditor.class)
    private List<Long> roleIds;

}
